<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2892：强袭作战</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">强袭作战</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">强袭作战</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                强袭作战                </h1>
                <p>时间限制：50s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：512MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div><span style="font-size: 12pt">在一个没有冬马的世界里，经历了学园祭后的春希着急着想要见到心爱的雪菜。然而在排队想见雪菜的</span><span style="font-size: 12pt">fans</span><span style="font-size: 12pt">太多了，春希一时半会凑不到雪菜面前。</span></div>
<div><span style="font-size: 12pt">作为高帅富，这样的问题怎么能难倒春希？春希从武也手中拿到了取自金闪闪宝库里的多啦</span><span style="font-size: 12pt">A</span><span style="font-size: 12pt">梦的传话筒，并且给每一个排队的</span><span style="font-size: 12pt">fans</span><span style="font-size: 12pt">都发了一个传话筒。</span></div>
<div><span style="font-size: 12pt">于是现在有</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">个人排成一列，第一个人是雪菜，后面</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">个人是雪菜的</span><span style="font-size: 12pt">fans</span><span style="font-size: 12pt">。第</span><span style="font-size: 12pt">I</span><span style="font-size: 12pt">个</span><span style="font-size: 12pt">fan</span><span style="font-size: 12pt">能在他的左侧中选一个距离不超过</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">的人发出频率在</span><span style="font-size: 12pt">[xi,yi]</span><span style="font-size: 12pt">的音波，并且第</span><span style="font-size: 12pt">I</span><span style="font-size: 12pt">个</span><span style="font-size: 12pt">fan</span><span style="font-size: 12pt">也能接受频率在</span><span style="font-size: 12pt">[xi,yi]</span><span style="font-size: 12pt">的音波。特别的，雪菜能接受所有频率的音波。</span></div>
<div><span style="font-size: 12pt">春希有些话想通过传话筒告诉雪菜，他想选择一个人作为传话的起始点，但不知道选谁比较好，作为春希的好友的你，能告诉他答案吗？</span></div>
<div><span style="font-size: 12pt">传话的具体解释：第</span><span style="font-size: 12pt">I</span><span style="font-size: 12pt">个人能选择其左边的距离不超过</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">的一个人</span><span style="font-size: 12pt">J</span><span style="font-size: 12pt">，只要双方对应的区间有交集，那么第</span><span style="font-size: 12pt">I</span><span style="font-size: 12pt">个人就能将信息传达给</span><span style="font-size: 12pt">J</span><span style="font-size: 12pt">。然后</span><span style="font-size: 12pt">J</span><span style="font-size: 12pt">又可以继续找下一个人传达信息。传达一次信息要</span><span style="font-size: 12pt">1</span><span style="font-size: 12pt">单位时间。</span></div></p><hr/><h3>输入格式</h3><p><div style="text-indent: 24pt" align="left"><span style="font-size: 12pt">第一行两个正整数</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">、L</span><span style="font-size: 12pt">。接下来</span><span style="font-size: 12pt">N-</span><span style="font-size: 12pt">1</span><span style="font-size: 12pt">行，第</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">行包含了三个正整数xi</span><i><span style="font-size: 12pt">、</span></i><span style="font-size: 12pt">yi</span><i><span style="font-size: 12pt">、</span></i><span style="font-size: 12pt">li</span><span style="font-size: 12pt">，其中</span><span style="font-size: 12pt">l</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">表示第</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">个人距离雪菜有l</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">的距离</span><span style="font-size: 12pt">，满足</span><span style="font-size: 12pt">l</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">严格递增。</span></div></p><hr/><h3>输出格式</h3><p><div style="margin: 13pt 0cm">&nbsp;</div>
<div style="text-indent: 24pt" align="left"><span style="font-size: 12pt">总共</span><span style="font-size: 12pt">N</span><i><span style="font-size: 12pt">-</span></i><span style="font-size: 12pt">1</span><span style="font-size: 12pt">行，每行一个数分别表示</span><span style="font-size: 12pt">2</span><span style="font-size: 12pt">到</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">号fan至少需要多少单位时间，雪菜才能收到信息，如果无法传到雪菜则输出</span><span style="font-size: 12pt">-1</span><span style="font-size: 12pt">。</span></div></p><hr/><h3>样例输入</h3><pre>3 1
1 2 1
2 3 2
</pre><hr/><h3>样例输出</h3><pre>1
2
【数据规模和约定】
30%的数据满足N <=20000; 
100%的数据满足2 <=N<= 2.5*10^5、0<=xi，yi，li<=2*10^9，1<=L<=2*10^9,xi<=yi． </pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2892" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2892" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>